package com.work.order.controller;

import com.work.order.aop.Idempotent;
import com.work.order.model.YhSettleReceiptApply;
import com.work.order.service.YhSettleReceiptApplyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashSet;
import java.util.Set;

@RestController
@RequestMapping("/orders")
public class OrderController {

    @Autowired
    private YhSettleReceiptApplyService orderService;

    @PostMapping("/add")
    @Idempotent
    public ResponseEntity<String> addOrder(@RequestBody YhSettleReceiptApply order) {
        // 处理订单逻辑
        try {
            orderService.addOrder(order);
            return ResponseEntity.ok("订单添加成功");
        } catch (RuntimeException e) {
            return ResponseEntity.ok(e.getMessage());
        }

    }

}
